﻿Imports EstoqueDAL
Public Class ServicoFRM
    '{vw_EstServico.sta_descricao}

    Private Sub RbAtivo_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RbAtivo.CheckedChanged
        If (RbAtivo.Checked) Then gerarelatrio("Relatório de Serviços Ativos", "")
    End Sub

    Private Sub RBInativo_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RBInativo.CheckedChanged
        If (RBInativo.Checked) Then gerarelatrio("Relatório de Serviços Inativos", "")
    End Sub

    Private Sub RBTodas_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RBTodas.CheckedChanged
        If (RBTodas.Checked) Then gerarelatrio("Relatório com Todos os Serviços", "")
    End Sub

#Region "Relatorio"
    Public Sub gerarelatrio(titulo As String, formula As String)
        Try
            Dim frmrecursos As New RelatoriosFRM
            Dim rpt As New ServicoDetalhado
            Try
                rpt.SetDatabaseLogon(usuarios, senha)
                rpt.SetParameterValue(0, titulo)
                rpt.RecordSelectionFormula = formula
                frmrecursos.CrystalReportViewer1.ShowGroupTreeButton = False
                frmrecursos.CrystalReportViewer1.ReportSource = rpt
                frmrecursos.ShowDialog()
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
            frmrecursos.Dispose()
            rpt = Nothing
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Finally

        End Try
    End Sub
#End Region
End Class